package com.example.design.patterns.冰河.行为模式.中介者模式.concreteMediator;

import com.example.design.patterns.冰河.行为模式.中介者模式.colleagueClass.ColleagueA;
import com.example.design.patterns.冰河.行为模式.中介者模式.colleagueClass.ColleagueB;
import com.example.design.patterns.冰河.行为模式.中介者模式.mediator.Mediator;

/**
 * ConcreteMediator 具体中介者通过协调各同事对象实现协作行为.
 * 了解并维护他的各个同事
 */
public class ConcreteMediator extends Mediator {
    private ColleagueA ca;
    private ColleagueB cb;

    public ConcreteMediator() {
        this.ca = new ColleagueA();
        this.cb = new ColleagueB();
    }

    /**
     *
     * @param content
     */
    @Override
    public void notice(String content) {
        if ("boss".equals(content)) {
            //老板来了,通知员工
            ca.action();
        }
        if ("client".equals(content)) {
            //客户来了,通知前台
            cb.action();
        }
    }
}
